<template>
  <div>
    <div class="box">
        <h3>数据的接收方</h3>
        <div>
            接收的数据值{{count}}
        </div>
    </div>
  </div>
</template>

<script>
import bus from './eventBus.js'
export default {
    name:'Right',
    data(){
        return{
            count:2
        }
    },
    created(){
        // 调用bus.on，通过事件处理函数的形参接收数据
        bus.on('onchange',(count)=>{
            this.count=count
        })
    }

}
</script>

<style lang="less" >
.box{
    border: 1px solid black;
    box-sizing: border-box;
    width: 300px;
    height: 300px;
}

</style>